home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / sys5 / iscwmpst.z / iscwmpst / tcp / src / icmp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-25  |  5.4 KB  |  159 lines

  1. /* @(#) $Header: icmp.h,v 1.5 91/02/24 20:16:53 deyke Exp $ */
  2.  
  3. #ifndef _ICMP_H
  4. #define _ICMP_H
  5.  
  6. #ifndef _GLOBAL_H
  7. #include "global.h"
  8. #endif
  9.  
  10. #ifndef _MBUF_H
  11. #include "mbuf.h"
  12. #endif
  13.  
  14. #ifndef _IFACE_H
  15. #include "iface.h"
  16. #endif
  17.  
  18. #ifndef _INTERNET_H
  19. #include "internet.h"
  20. #endif
  21.  
  22. #ifndef _IP_H
  23. #include "ip.h"
  24. #endif
  25.  
  26. #ifndef _SESSION_H
  27. #include "session.h"
  28. #endif
  29.  
  30. #ifndef _TIMER_H
  31. #include "timer.h"
  32. #endif
  33.  
  34. /* SNMP MIB variables, used for statistics and control. See RFC 1066 */
  35. extern struct mib_entry Icmp_mib[];
  36. #define icmpInMsgs              Icmp_mib[1].value.integer
  37. #define icmpInErrors            Icmp_mib[2].value.integer
  38. #define icmpInDestUnreachs      Icmp_mib[3].value.integer
  39. #define icmpInTimeExcds         Icmp_mib[4].value.integer
  40. #define icmpInParmProbs         Icmp_mib[5].value.integer
  41. #define icmpInSrcQuenchs        Icmp_mib[6].value.integer
  42. #define icmpInRedirects         Icmp_mib[7].value.integer
  43. #define icmpInEchos             Icmp_mib[8].value.integer
  44. #define icmpInEchoReps          Icmp_mib[9].value.integer
  45. #define icmpInTimestamps        Icmp_mib[10].value.integer
  46. #define icmpInTimestampReps     Icmp_mib[11].value.integer
  47. #define icmpInAddrMasks         Icmp_mib[12].value.integer
  48. #define icmpInAddrMaskReps      Icmp_mib[13].value.integer
  49. #define icmpOutMsgs             Icmp_mib[14].value.integer
  50. #define icmpOutErrors           Icmp_mib[15].value.integer
  51. #define icmpOutDestUnreachs     Icmp_mib[16].value.integer
  52. #define icmpOutTimeExcds        Icmp_mib[17].value.integer
  53. #define icmpOutParmProbs        Icmp_mib[18].value.integer
  54. #define icmpOutSrcQuenchs       Icmp_mib[19].value.integer
  55. #define icmpOutRedirects        Icmp_mib[20].value.integer
  56. #define icmpOutEchos            Icmp_mib[21].value.integer
  57. #define icmpOutEchoReps         Icmp_mib[22].value.integer
  58. #define icmpOutTimestamps       Icmp_mib[23].value.integer
  59. #define icmpOutTimestampReps    Icmp_mib[24].value.integer
  60. #define icmpOutAddrMasks        Icmp_mib[25].value.integer
  61. #define icmpOutAddrMaskReps     Icmp_mib[26].value.integer
  62. #define NUMICMPMIB      26
  63.  
  64. /* Internet Control Message Protocol */
  65.  
  66. /* Message types */
  67. #define ICMP_ECHO_REPLY         0       /* Echo Reply */
  68. #define ICMP_DEST_UNREACH       3       /* Destination Unreachable */
  69. #define ICMP_QUENCH             4       /* Source Quench */
  70. #define ICMP_REDIRECT           5       /* Redirect */
  71. #define ICMP_ECHO               8       /* Echo Request */
  72. #define ICMP_TIME_EXCEED        11      /* Time-to-live Exceeded */
  73. #define ICMP_PARAM_PROB         12      /* Parameter Problem */
  74. #define ICMP_TIMESTAMP          13      /* Timestamp */
  75. #define ICMP_TIME_REPLY         14      /* Timestamp Reply */
  76. #define ICMP_INFO_RQST          15      /* Information Request */
  77. #define ICMP_INFO_REPLY         16      /* Information Reply */
  78. #define ICMP_ADDR_MASK          17      /* Address mask request */
  79. #define ICMP_ADDR_MASK_REPLY    18      /* Address mask reply */
  80. #define ICMP_TYPES              19
  81.  
  82. /* Internal format of an ICMP header (checksum is missing) */
  83. struct icmp {
  84.     char type;
  85.     char code;
  86.     union icmp_args {
  87.         int16 mtu;
  88.         int32 unused;
  89.         unsigned char pointer;
  90.         int32 address;
  91.         struct {
  92.             int16 id;
  93.             int16 seq;
  94.         } echo;
  95.     } args;
  96. };
  97. #define ICMPLEN         8       /* Length of ICMP header on the net */
  98. #define NULLICMP        (union icmp_args *)0
  99.  
  100. /* Destination Unreachable codes */
  101. #define ICMP_NET_UNREACH        0       /* Net unreachable */
  102. #define ICMP_HOST_UNREACH       1       /* Host unreachable */
  103. #define ICMP_PROT_UNREACH       2       /* Protocol unreachable */
  104. #define ICMP_PORT_UNREACH       3       /* Port unreachable */
  105. #define ICMP_FRAG_NEEDED        4       /* Fragmentation needed and DF set */
  106. #define ICMP_ROUTE_FAIL         5       /* Source route failed */
  107.  
  108. #define NUNREACH        6
  109.  
  110. /* Time Exceeded codes */
  111. #define ICMP_TTL_EXCEED         0       /* Time-to-live exceeded */
  112. #define ICMP_FRAG_EXCEED        1       /* Fragment reassembly time exceeded */
  113.  
  114. #define NEXCEED         2
  115.  
  116. /* Redirect message codes */
  117. #define ICMP_REDR_NET   0       /* Redirect for the network */
  118. #define ICMP_REDR_HOST  1       /* Redirect for the host */
  119. #define ICMP_REDR_TOS   2       /* Redirect for Type of Service, or-ed with prev */
  120.  
  121. #define NREDIRECT       3
  122.  
  123. extern int Icmp_trace;
  124.  
  125. struct ping {
  126.     struct ping *next;      /* Linked list pointers */
  127.     struct ping *prev;
  128.     int32 target;           /* Starting target IP address */
  129.     int32 sent;             /* Total number of pings sent */
  130.     int32 srtt;             /* Smoothed round trip time */
  131.     int32 mdev;             /* Mean deviation */
  132.     int32 responses;        /* Total number of responses */
  133.     struct timer timer;     /* Ping interval timer */
  134.     int16 len;              /* Length of data portion of ping */
  135. };
  136. /* ICMP messages, decoded */
  137. extern char *Icmptypes[],*Unreach[],*Exceed[],*Redirect[];
  138.  
  139. struct icmplink {
  140.     char proto;
  141.     void (*funct) __ARGS((int32,int32,int32,int,int,struct mbuf **));
  142. };
  143. extern struct icmplink Icmplink[];
  144.  
  145. /* In icmp.c: */
  146. void icmp_input __ARGS((struct iface *iface,struct ip *ip,struct mbuf *bp,
  147.     int rxbroadcast));
  148. int icmp_output __ARGS((struct ip *ip,struct mbuf *data,int type,int code,
  149.     union icmp_args *args));
  150.  
  151. /* In icmpcmd.c: */
  152. void echo_proc __ARGS((int32 source,int32 dest,struct icmp *icmp,struct mbuf *bp));
  153.  
  154. /* In icmphdr.c: */
  155. struct mbuf *htonicmp __ARGS((struct icmp *icmp,struct mbuf *data));
  156. int ntohicmp __ARGS((struct icmp *icmp,struct mbuf **bpp));
  157.  
  158. #endif  /* _ICMP_H */
  159.